<link href="asset/css/show.css" rel="stylesheet" type="text/css">
<script src="asset/js/cetak_excel.js"></script>
<?php
	$tgl = date("d");
	$bln = date("m");
	$thn = date("Y");
	
	$periode = $_POST['periode'];
	$bln1 = $_POST['bln1'];
	$thn1 = $_POST['thn1'];
	if($bln1 != '' && $thn1 != ''){
		$jml_hari = cal_days_in_month(CAL_GREGORIAN, $bln1, $thn1);
	}
?>
<div id="tiga_ba">
	<div id="tiga_baa">Laporan Absensi Klaim Pending </div>
	<div id="tiga_bab">
		<!--<a href=""><img src="asset/images/print.png" align="right" width="25"></a>-->
	</div>
	<div class="clear"></div>
</div>

<form method=post action='utama.php?module=mod_rekap&view=absensi'>
	<table style="margin-left: 5px;">
		<tr>
			<td>Bulan Klaim </td>
			<td>
				<select name="bln1" id="bln1" class="input1" <?php echo $p2; ?>>
					<?php
						for($i=1;$i<=12;$i++){
							if($i == $bln && $bln1 == ''){
								$s = "selected";
							}else if($i == $bln1){
								$s = "selected";
							}else{
								$s = "";
							}
							$bulan = array('1' => 'Januari', '2' => 'Februari', '3' => 'Maret', '4' => 'April', '5' => 'Mei', '6' => 'Juni', '7' => 'Juli', '8' => 'Agustus', '9' => 'September', '10' => 'Oktober', '11' => 'November', '12' => 'Desember');
							echo "<option value=$i $s>$bulan[$i]</option>";
						}
					?>
				</select>
				<select name="thn1" id="thn1" class="input1">
					<?php
						for($i=2010;$i<=2020;$i++){
							if($i == $thn && $thn1 == ''){
								$s = "selected";
							}else if($i == $thn1){
								$s = "selected";
							}else{
								$s = "";
							}
							echo "<option value=$i $s>$i</option>";
						}
					?>
				</select>
			</td>
		</tr>
		<tr>
			<td></td>
			<td><input name="submit" id="proses" type="submit" class="button" value="Proses" /></td>
			<td></td>
			<td></td>
		</tr>
	</table>
</form>
<?php
	if($_POST['submit'] == 'Proses'){
		if($_SESSION['id_jenis_pengguna'] == 5){
			$user = "and k.id_verifikator = $_SESSION[id_pengguna]";
		}else{
			$user = "";
		}
	?>
		<table class="tabel">
			<tr>
				<th>No</th>
				<th>Jenis</th>
				<?php
					for($i=1;$i<=$jml_hari;$i++){
						echo "<th>$i</th>";
					}
				?>
			</tr>
			<tr>
				<td align="center">1</td>
				<td>RJTL</td>
				<?php
					for($i=1;$i<=$jml_hari;$i++){
						$sql="select count(k.id_klaim) as jml from klaim k inner join jenis_layanan j on j.id_jenis_layanan = k.id_jenis_layanan where k.id_status <> 15 and tgl_trans = '$thn1-$bln1-$i' and j.kode = '1' $user";
						$jml = mysql_fetch_array(mysql_query($sql));
						if($jml['jml'] > 0){
							$warna = "bgcolor = '#ff0000'";
						}else{
							$warna = "bgcolor = '#00ff00'";
						}
						echo "<td align=center $warna>$jml[jml]</td>";
					}
				?>
			</tr>
			<tr>
				<td align="center">2</td>
				<td>RITL</td>
				<?php
					for($i=1;$i<=$jml_hari;$i++){
						$sql="select count(k.id_klaim) as jml from klaim k inner join jenis_layanan j on j.id_jenis_layanan = k.id_jenis_layanan where id_status <> 15 and tgl_trans = '$thn1-$bln1-$i' and j.kode = '2' $user";
						$jml = mysql_fetch_array(mysql_query($sql));
						if($jml['jml'] > 0){
							$warna = "bgcolor = '#ff0000'";
						}else{
							$warna = "bgcolor = '#00ff00'";
						}
						echo "<td align=center $warna>$jml[jml]</td>";
					}
				?>
			</tr>
		</table>
	<?php
	}
	?>
